﻿using my_webapi_demo.Common;
using StackExchange.Redis;

namespace my_webapi_demo.Redis;

internal class RedisClient
{
	public static IDatabase Database { get; }

	public static ConnectionMultiplexer Redis { get; }

	public static IServer Server { get; set; }

	static RedisClient()
	{
		var connection = AppConfig.Settings.RedisConnection;

		Redis    = ConnectionMultiplexer.Connect(connection);
		Database = Redis.GetDatabase();
		Server   = Redis.GetServer(Redis.GetEndPoints()[0]);
	}
}